package spring.security.oauth2.controller;

import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import spring.security.oauth2.entity.KikiResponse;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @description:
 * @author: chenzekai
 * @create: 2020/05/19
 **/
@RestController
@RequestMapping("/kiki")
public class KikiOauthController {
    @GetMapping(value = "/getCode")
    public KikiResponse getCode(HttpServletRequest request, HttpServletResponse response){
        return new KikiResponse()
                .put("code",request.getParameter("code"))
                .put("state",request.getParameter("state"));
    }

    @GetMapping("/authentication")
    public Object authentication(Authentication authentication){
        return authentication;
    }

    @GetMapping("/hello/read")
    public String helloRead(){
        return "hello  kiki read";
    }

    @GetMapping("/hello/write")
    public String helloWrite(){
        return "hello  kiki write";
    }


}
